/*
 * IRSystemView.java
 */

package irsystem.view;

import irsystem.model.IndexTable;
import irsystem.model.Stemmer;
import irsystem.model.TermWeighting;
import irsystem.model.document;
import java.io.File;
import org.jdesktop.application.Action;
import org.jdesktop.application.ResourceMap;
import org.jdesktop.application.SingleFrameApplication;
import org.jdesktop.application.FrameView;
import org.jdesktop.application.TaskMonitor;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.BufferedReader;
import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.swing.ButtonGroup;
import javax.swing.Timer;
import javax.swing.Icon;
import javax.swing.JDialog;
import javax.swing.JFileChooser;
import javax.swing.JFrame;

/**
 * The application's main frame.
 */
public class IRSystemView extends FrameView {

    /* konstanta */
        private static final int RAW_TF = 0;
        private static final int LOG_TF = 1;
        private static final int BINARY_TF = 2;
        private static final int AUGMENTED_TF = 3;
        
    /* atribut-atribut yang dimiliki kelas IRSystemView */
        JFileChooser fc = new JFileChooser();

        File currentDir = new File(System.getProperty("user.dir"));
        File fileStopWord = null, fileQuery = null, fileDC = null, fileRJ = null;
        FileInputStream fstreamStopWord = null, fstreamQuery = null, fstreamDC = null, fstreamRJ = null;

        Set < String > stopwords;
        Map<Integer,List < Integer > > RJ=new HashMap<Integer, List < Integer > >();
        public static final List < document > DC = new ArrayList < document > ();
        public static final List < document > Query = new ArrayList < document > ();

        Set<String> ListTerm = new HashSet<String>();
        
        IndexTable invertedFile_Doc, invertedFile_Query;

        boolean isStopWord = false, isStemming = false, isIDFDoc = false, isNormDoc = false, isIDFQuery = false, isNormQuery;
        int codeTFDoc, codeTFQuery;

    public IRSystemView(SingleFrameApplication app) {
        super(app);

        initComponents();

        // status bar initialization - message timeout, idle icon and busy animation, etc
        ResourceMap resourceMap = getResourceMap();
        int messageTimeout = resourceMap.getInteger("StatusBar.messageTimeout");
        messageTimer = new Timer(messageTimeout, new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                statusMessageLabel.setText("");
            }
        });
        messageTimer.setRepeats(false);
        int busyAnimationRate = resourceMap.getInteger("StatusBar.busyAnimationRate");
        for (int i = 0; i < busyIcons.length; i++) {
            busyIcons[i] = resourceMap.getIcon("StatusBar.busyIcons[" + i + "]");
        }
        busyIconTimer = new Timer(busyAnimationRate, new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                busyIconIndex = (busyIconIndex + 1) % busyIcons.length;
                statusAnimationLabel.setIcon(busyIcons[busyIconIndex]);
            }
        });
        idleIcon = resourceMap.getIcon("StatusBar.idleIcon");
        statusAnimationLabel.setIcon(idleIcon);
        progressBar.setVisible(false);

        // connecting action tasks to status bar via TaskMonitor
        TaskMonitor taskMonitor = new TaskMonitor(getApplication().getContext());
        taskMonitor.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
            public void propertyChange(java.beans.PropertyChangeEvent evt) {
                String propertyName = evt.getPropertyName();
                if ("started".equals(propertyName)) {
                    if (!busyIconTimer.isRunning()) {
                        statusAnimationLabel.setIcon(busyIcons[0]);
                        busyIconIndex = 0;
                        busyIconTimer.start();
                    }
                    progressBar.setVisible(true);
                    progressBar.setIndeterminate(true);
                } else if ("done".equals(propertyName)) {
                    busyIconTimer.stop();
                    statusAnimationLabel.setIcon(idleIcon);
                    progressBar.setVisible(false);
                    progressBar.setValue(0);
                } else if ("message".equals(propertyName)) {
                    String text = (String)(evt.getNewValue());
                    statusMessageLabel.setText((text == null) ? "" : text);
                    messageTimer.restart();
                } else if ("progress".equals(propertyName)) {
                    int value = (Integer)(evt.getNewValue());
                    progressBar.setVisible(true);
                    progressBar.setIndeterminate(false);
                    progressBar.setValue(value);
                }
            }
        });
        menuBar.setVisible(false);
        statusPanel.setVisible(false);
        
        this.getFrame().setTitle("Information Retrieval System");
        this.getFrame().setResizable(false);

        //[Document]
            //TermWeighting
                this.bgTFDoc = new ButtonGroup();
                this.bgTFDoc.add(RBRawTF_Doc);
                this.bgTFDoc.add(RBLogaritmicTF_Doc);
                this.bgTFDoc.add(RBBinaryTF_Doc);
                this.bgTFDoc.add(RBAugmentedTF_Doc);
                this.RBRawTF_Doc.setSelected(true);
                this.codeTFDoc = RAW_TF;

            //InverseDocumentFrequency
                this.bgIDFDoc = new ButtonGroup();
                this.bgIDFDoc.add(RBNoneIDF_Doc);
                this.bgIDFDoc.add(RBUsingIDF_Doc);
                this.RBNoneIDF_Doc.setSelected(true);

            //Normalization
                this.bgNormDoc = new ButtonGroup();
                this.bgNormDoc.add(RBNoneNormalization_Doc);
                this.bgNormDoc.add(RBUsingNormalization_Doc);
                this.RBNoneNormalization_Doc.setSelected(true);

        //[Query]
            //TermWeighting
                this.bgTFQuery = new ButtonGroup();
                this.bgTFQuery.add(RBRawTF_Query);
                this.bgTFQuery.add(RBLogaritmicTF_Query);
                this.bgTFQuery.add(RBBinaryTF_Query);
                this.bgTFQuery.add(RBAugmentedTF_Query);
                this.RBRawTF_Query.setSelected(true);
                this.codeTFQuery = RAW_TF;

            //InverseDocumentFrequency
                this.bgIDFQuery = new ButtonGroup();
                this.bgIDFQuery.add(RBNoneIDF_Query);
                this.bgIDFQuery.add(RBUsingIDF_Query);
                this.RBNoneIDF_Query.setSelected(true);

            //Normalization
                this.bgNormQuery = new ButtonGroup();
                this.bgNormQuery.add(RBNoneNormalization_Query);
                this.bgNormQuery.add(RBUsingNormalization_Query);
                this.RBNoneNormalization_Query.setSelected(true);
                
        //Stemming
            this.bgStemming = new ButtonGroup();
            this.bgStemming.add(RBNoneStemming);
            this.bgStemming.add(RBUsingStemming);
            this.RBNoneStemming.setSelected(true);

        //StopWord
            this.bgStopWord = new ButtonGroup();
            this.bgStopWord.add(RBNoneStopWord);
            this.bgStopWord.add(RBUsingStopWord);
            this.RBNoneStopWord.setSelected(true);
            this.ButtonBrowseStopWord.setEnabled(false);
    }

    private void importStopWord (FileInputStream fstream) {
        try {
            DataInputStream in = new DataInputStream(fstream);
            BufferedReader buffreadr = new BufferedReader(new java.io.InputStreamReader(in));

            String str;
            while ((str = buffreadr.readLine()) != null) {
                stopwords.add(str.toLowerCase());
            }

            in.close();

        } catch (Exception e) {
            System.err.println("logtag - exception IRSystemView.importFromTextFile : " + e.getMessage());
        }
    }

    private void Parse_DocumentCollection_Default(){
        try {
            int docID = 0;
            DC.clear();
            ArrayList < String > text = new ArrayList < String > ();
            DataInputStream in = new DataInputStream(fstreamDC);
            BufferedReader buffreadr = new BufferedReader(new InputStreamReader(in));
            String str;

            while ((str = buffreadr.readLine()) != null) {
                str = str.replaceAll("\\s+", " ");      //Remove double white space
                str = str.trim().replaceAll(" +", " "); //Remove white space at beginning and end of string

                if (!str.isEmpty()){
                    //Find ID
                    String[] SubString = str.split(" ");
                    if (SubString[0].equals(".I")){
                        if (docID != 0 && !text.isEmpty()){
                            //Add last ID and text to document collection
                            DC.add(new document(docID, text));
                            text = new ArrayList < String > ();
                        }
                        //New doc ID
                        docID = Integer.parseInt(SubString[1]);
                    }

                    else if (SubString[0].equals(".W")){
                        //Read text
                        str = buffreadr.readLine();
                        str = str.replaceAll("\\s+", " ");      //Remove double white space
                        str = str.trim().replaceAll(" +", " "); //Remove white space at beginning and end of string

                        while (str != null && !str.startsWith(".") && !str.isEmpty()){
                            str = str.replaceAll("[^A-Za-z0-9']", " "); //Replace punctuation mark with space, except '
                            str = str.replaceAll("\\s+", " ");      //Remove double white space
                            SubString = str.toLowerCase().split(" ");

                            for (String temp : SubString) {
                                if (!temp.equals("'") || !temp.equals("")) {
                                    if (temp.startsWith("'") && temp.endsWith("'")) text.add(temp.substring(1, temp.length()-2));
                                    else if (temp.startsWith("'")) text.add(temp.substring(1));
                                    else if (temp.endsWith("'")) text.add(temp.substring(0, temp.length()-2));
                                    else text.add(temp);
                                }
                            }

                            str = buffreadr.readLine();
                            str = str.replaceAll("\\s+", " ");      //Remove double white space
                            str = str.trim().replaceAll(" +", " "); //Remove white space at beginning and end of string
                        }
                        if (str != null){
                            SubString = str.split(" ");
                            if (SubString[0].equals(".I")){
                                if (docID != 0 && !text.isEmpty()){
                                    //Add last ID and text to document collection
                                    DC.add(new document(docID, text));
                                    text = new ArrayList < String > ();
                                }

                                //New doc ID
                                docID = Integer.parseInt(SubString[1]);
                            }
                        }
                    }
                }
            }
            //Add last ID and text to document collection
            if (docID != 0 && !text.isEmpty()){
                DC.add(new document(docID, text));
            }

            in.close();

            //***DEBUG***
//            for (int i = 0; i < DC.size(); i++){
//                System.out.println("ID : " + DC.get(i).getID());
//                System.out.println("Text : ");
//                for (int j = 0; j < DC.get(i).getText().size(); j++){
//                    System.out.println(DC.get(i).getText().get(j));
//                }
//                System.out.println("");
//            }

        } catch (Exception e) {
            System.err.println("logtag - exception IRSystemView.Parse_DocumentCollection_Default() : " + e.getMessage());
        }
    }

    private void Parse_DocumentCollection_NPL(){
        try {
            DC.clear();
            boolean keepRead;
            int docID = 0;
            ArrayList < String > text = new ArrayList < String > ();
            DataInputStream in = new DataInputStream(fstreamDC);
            BufferedReader buffreadr = new BufferedReader(new InputStreamReader(in));
            String str;

            while ((str = buffreadr.readLine()) != null) {
                str = str.replaceAll("\\s+", " ");      //Remove double white space
                str = str.trim().replaceAll(" +", " "); //Remove white space at beginning and end of string

                if (!str.isEmpty() && !str.equals("/")){
                    //get ID
                    docID = Integer.parseInt(str);

                    //Read Text
                    keepRead = true;
                    while (keepRead && ((str = buffreadr.readLine()) != null)){
                        str = str.replaceAll("\\s+", " ");      //Remove double white space
                        str = str.trim().replaceAll(" +", " "); //Remove white space at beginning and end of string

                        if (str.equals("/")){
                            keepRead = false;
                        }else{
                            str = str.replaceAll("[^A-Za-z0-9']", " "); //Replace punctuation mark with space, except '
                            str = str.replaceAll("\\s+", " ");      //Remove double white space
                            String[] SubString = str.toLowerCase().split(" ");

                            for (String temp : SubString) {
                                if (!temp.equals("'") || !temp.equals("")) {
                                    if (temp.startsWith("'") && temp.endsWith("'")) text.add(temp.substring(1, temp.length()-2));
                                    else if (temp.startsWith("'")) text.add(temp.substring(1));
                                    else if (temp.endsWith("'")) text.add(temp.substring(0, temp.length()-2));
                                    else text.add(temp);
                                }
                            }
                        }
                    }

                    //Add last ID and text to document collection
                    DC.add(new document(docID, text));
                    text = new ArrayList < String > ();
                }
            }

            in.close();

            //***DEBUG***
//            for (int i = 0; i < DC.size(); i++){
//                System.out.println("ID : " + DC.get(i).getID());
//                System.out.println("Text : ");
//                for (int j = 0; j < DC.get(i).getText().size(); j++){
//                    System.out.println(DC.get(i).getText().get(j));
//                }
//                System.out.println("");
//            }
        } catch (Exception e) {
            System.err.println("logtag - exception IRSystemView.Parse_DocumentCollection_NPL() : " + e.getMessage());
        }
    }

    private void Parse_Query(){
        try {
            Query.clear();
            int docID = 0;
            ArrayList < String > text = new ArrayList < String > ();
            DataInputStream in = new DataInputStream(fstreamQuery);
            BufferedReader buffreadr = new BufferedReader(new InputStreamReader(in));
            String str;

            while ((str = buffreadr.readLine()) != null) {
                str = str.replaceAll("\\s+", " ");      //Remove double white space
                str = str.trim().replaceAll(" +", " "); //Remove white space at beginning and end of string

                if (!str.isEmpty()){
                    //Find ID
                    String[] SubString = str.split(" ");
                    if (SubString[0].equals(".I")){
                        if (docID != 0 && !text.isEmpty()){
                            //Add last ID and text to document collection
                            Query.add(new document(docID, text));
                            text = new ArrayList < String > ();
                        }
                        //New doc ID
                        docID = Integer.parseInt(SubString[1]);

                    }

                    else if (SubString[0].equals(".W")){
                        //Read text
                        str = buffreadr.readLine();
                        str = str.replaceAll("\\s+", " ");      //Remove double white space
                        str = str.trim().replaceAll(" +", " "); //Remove white space at beginning and end of string

                        while (str != null && !str.startsWith(".") && !str.isEmpty()){
                            str = str.replaceAll("[^A-Za-z0-9']", " "); //Replace punctuation mark with space, except '
                            str = str.replaceAll("\\s+", " ");          //Remove double white space
                            SubString = str.toLowerCase().split(" ");

                            for (String temp : SubString) {
                                if (!temp.equals("'") || !temp.equals("")) {
                                    if (temp.startsWith("'") && temp.endsWith("'")) text.add(temp.substring(1, temp.length()-2));
                                    else if (temp.startsWith("'")) text.add(temp.substring(1));
                                    else if (temp.endsWith("'")) text.add(temp.substring(0, temp.length()-2));
                                    else text.add(temp);
                                }
                            }
                            
                            str = buffreadr.readLine();
                            str = str.replaceAll("\\s+", " ");      //Remove double white space
                            str = str.trim().replaceAll(" +", " "); //Remove white space at beginning and end of string
                        }
                        if (str != null){
                            SubString = str.split(" ");
                            if (SubString[0].equals(".I")){
                                if (docID != 0 && !text.isEmpty()){
                                    //Add last ID and text to document collection
                                    Query.add(new document(docID, text));
                                    text = new ArrayList < String > ();
                                }
                                //New doc ID
                                docID = Integer.parseInt(SubString[1]);
                            }
                        }
                    }
                }
            }
            //Add last ID and text to document collection
            if (docID != 0 && !text.isEmpty()){
                Query.add(new document(docID, text));
            }

            in.close();

            //***DEBUG***
//            for (int i = 0; i < Query.size(); i++){
//                System.out.println("ID : " + Query.get(i).getID());
//                System.out.println("Text : ");
//                for (int j = 0; j < Query.get(i).getText().size(); j++){
//                    System.out.println(Query.get(i).getText().get(j));
//                }
//                System.out.println("");
//            }
//            System.out.println("SIZE : " + Query.size());
        } catch (Exception e) {
            System.err.println("logtag - exception IRSystemView.Parse_Query() : " + e.getMessage());
        }
    }

    private void Parse_RJ() {
        try {
            RJ.clear();
            DataInputStream in = new DataInputStream(fstreamRJ);
            BufferedReader buffreadr = new BufferedReader(new InputStreamReader(in));
            String str;

            while ((str = buffreadr.readLine()) != null) {
                String[] temp = str.split("\\s+");
                try {
                    Integer IDQuery = Integer.parseInt(temp[0]);
                    Integer IDDoc = Integer.parseInt(temp[1]);
                    if (((List < Integer >)RJ.get(IDQuery))!= null) {
                        List < Integer > listdoc = (List < Integer >)RJ.get(IDQuery);
                        listdoc.add(IDDoc);
                        RJ.put(IDQuery,listdoc);
                    } else {
                        List<Integer> listdoc = new ArrayList<Integer> ();
                        listdoc.add(IDDoc);
                        RJ.put(IDQuery, listdoc);
                    }
                } catch (Exception e) {}
            }
            
            in.close();

            //***DEBUG***
//            Set set = RJ.entrySet();
//            // Get an iterator
//            Iterator i = set.iterator();
//            // Display elements
//            while(i.hasNext()) {
//                Map.Entry me = (Map.Entry)i.next();
//                System.out.print(me.getKey() + ": ");
//                System.out.println(me.getValue());
//            }
        } catch (Exception e) {
            System.err.println("logtag - exception IRSystemView.Parse_RJ() : " + e.getMessage());
        }
    }

    private boolean searchTermStopWord(String term) {
        boolean find = false;

        for (String str : this.stopwords) {
            if (str.toLowerCase().equals(term))
                find = true;
        }

        return find;
    }

    private void writeToFile(String NamaFile, boolean isDoc) {
        File file= new File(NamaFile);
        FileOutputStream fos;
        OutputStreamWriter out;
        try {
            fos = new FileOutputStream(file);
            out = new OutputStreamWriter(fos, Charset.forName("UTF-8"));

            StringBuilder sb = new StringBuilder();
            sb.append("Term\t");
            if (isDoc) {
                for (int i=0; i<DC.size(); ++i) sb.append("D"+ DC.get(i).getID() +"\t");

                out.write(sb.toString());

                int i = 0;
                for (String str : ListTerm) {
                    out.write("\n");
                    out.write(str + "\t");
                    for (int j=0; j<invertedFile_Doc.getColumn(); ++j) {
                        out.write(invertedFile_Doc.getCell(i,j)+"\t");
                    }
                    i++;
                }
            } else {
                for (int i=0; i<Query.size(); ++i) sb.append("Q" + Query.get(i).getID() + "\t");

                out.write(sb.toString());

                int i = 0;
                for (String str : ListTerm) {
                    out.write("\n");
                    out.write(str + "\t");
                    for (int j=0; j<invertedFile_Query.getColumn(); ++j) {
                        out.write(invertedFile_Query.getCell(i, j)+"\t");
                    }
                    i++;
                }
            }
            out.close();
            fos.close();
        } catch (FileNotFoundException ex) {
            System.err.println("logtag - exception IRSystemView.writeToFile() : " + ex.getMessage());
        } catch (IOException ex) {
            System.err.println("logtag - exception IRSystemView.writeToFile() : " + ex.getMessage());
        }
    }


    private void stemming() {
        Set<String> temp = new HashSet<String>();
        temp.addAll(ListTerm);
        Stemmer s = new Stemmer();
        ListTerm.clear();

        for (String str : temp) {
            char[] wStr = str.toCharArray();
            s.add(wStr,wStr.length);
            s.stem();
            ListTerm.add(s.toString());
        }

        ArrayList<String> tempDoc = new ArrayList<String>();
        for (document doc : DC) {
            for (String str : doc.getText()) {
                char[] wStr = str.toCharArray();
                s.add(wStr,wStr.length);
                s.stem();
                tempDoc.add(s.toString());
            }
            doc.setText(tempDoc);
        }

        ArrayList<String> tempQuery = new ArrayList<String>();
        for (document doc : Query) {
            for (String str : doc.getText()) {
                char[] wStr = str.toCharArray();
                s.add(wStr,wStr.length);
                s.stem();
                tempQuery.add(s.toString());
            }
            doc.setText(tempQuery);
        }
    }

    @Action
    public void showAboutBox() {
        if (aboutBox == null) {
            JFrame mainFrame = IRSystemApp.getApplication().getMainFrame();
            aboutBox = new IRSystemAboutBox(mainFrame);
            aboutBox.setLocationRelativeTo(mainFrame);
        }
        IRSystemApp.getApplication().show(aboutBox);
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        mainPanel = new javax.swing.JPanel();
        jPanel1 = new javax.swing.JPanel();
        jPanel2 = new javax.swing.JPanel();
        RBRawTF_Doc = new javax.swing.JRadioButton();
        RBLogaritmicTF_Doc = new javax.swing.JRadioButton();
        RBBinaryTF_Doc = new javax.swing.JRadioButton();
        RBAugmentedTF_Doc = new javax.swing.JRadioButton();
        jPanel3 = new javax.swing.JPanel();
        RBUsingIDF_Doc = new javax.swing.JRadioButton();
        RBNoneIDF_Doc = new javax.swing.JRadioButton();
        jPanel4 = new javax.swing.JPanel();
        RBUsingNormalization_Doc = new javax.swing.JRadioButton();
        RBNoneNormalization_Doc = new javax.swing.JRadioButton();
        jPanel5 = new javax.swing.JPanel();
        RBNoneStemming = new javax.swing.JRadioButton();
        RBUsingStemming = new javax.swing.JRadioButton();
        jPanel6 = new javax.swing.JPanel();
        RBUsingStopWord = new javax.swing.JRadioButton();
        RBNoneStopWord = new javax.swing.JRadioButton();
        TextFieldStopWord = new javax.swing.JTextField();
        TextFieldDocumentCollection = new javax.swing.JTextField();
        TextFieldQuery = new javax.swing.JTextField();
        TextFieldRelevantJudgement = new javax.swing.JTextField();
        ButtonBrowseRelevantJudgement = new javax.swing.JButton();
        ButtonBrowseQuery = new javax.swing.JButton();
        ButtonBrowseDocumentCollection = new javax.swing.JButton();
        ButtonBrowseStopWord = new javax.swing.JButton();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        ButtonOK = new javax.swing.JButton();
        jPanel7 = new javax.swing.JPanel();
        jPanel8 = new javax.swing.JPanel();
        RBRawTF_Query = new javax.swing.JRadioButton();
        RBLogaritmicTF_Query = new javax.swing.JRadioButton();
        RBBinaryTF_Query = new javax.swing.JRadioButton();
        RBAugmentedTF_Query = new javax.swing.JRadioButton();
        jPanel9 = new javax.swing.JPanel();
        RBNoneIDF_Query = new javax.swing.JRadioButton();
        RBUsingIDF_Query = new javax.swing.JRadioButton();
        jPanel10 = new javax.swing.JPanel();
        RBNoneNormalization_Query = new javax.swing.JRadioButton();
        RBUsingNormalization_Query = new javax.swing.JRadioButton();
        menuBar = new javax.swing.JMenuBar();
        javax.swing.JMenu fileMenu = new javax.swing.JMenu();
        javax.swing.JMenuItem exitMenuItem = new javax.swing.JMenuItem();
        javax.swing.JMenu helpMenu = new javax.swing.JMenu();
        javax.swing.JMenuItem aboutMenuItem = new javax.swing.JMenuItem();
        statusPanel = new javax.swing.JPanel();
        javax.swing.JSeparator statusPanelSeparator = new javax.swing.JSeparator();
        statusMessageLabel = new javax.swing.JLabel();
        statusAnimationLabel = new javax.swing.JLabel();
        progressBar = new javax.swing.JProgressBar();

        mainPanel.setName("mainPanel"); // NOI18N

        org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(irsystem.view.IRSystemApp.class).getContext().getResourceMap(IRSystemView.class);
        jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(resourceMap.getString("jPanel1.border.title"))); // NOI18N
        jPanel1.setName("jPanel1"); // NOI18N

        jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder(null, resourceMap.getString("jPanel2.border.title"), javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 0, 11), null)); // NOI18N
        jPanel2.setName("jPanel2"); // NOI18N

        RBRawTF_Doc.setText(resourceMap.getString("RBRawTF_Doc.text")); // NOI18N
        RBRawTF_Doc.setName("RBRawTF_Doc"); // NOI18N
        RBRawTF_Doc.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                RBRawTF_DocActionPerformed(evt);
            }
        });

        RBLogaritmicTF_Doc.setText(resourceMap.getString("RBLogaritmicTF_Doc.text")); // NOI18N
        RBLogaritmicTF_Doc.setName("RBLogaritmicTF_Doc"); // NOI18N
        RBLogaritmicTF_Doc.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                RBLogaritmicTF_DocActionPerformed(evt);
            }
        });

        RBBinaryTF_Doc.setText(resourceMap.getString("RBBinaryTF_Doc.text")); // NOI18N
        RBBinaryTF_Doc.setName("RBBinaryTF_Doc"); // NOI18N
        RBBinaryTF_Doc.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                RBBinaryTF_DocActionPerformed(evt);
            }
        });

        RBAugmentedTF_Doc.setText(resourceMap.getString("RBAugmentedTF_Doc.text")); // NOI18N
        RBAugmentedTF_Doc.setName("RBAugmentedTF_Doc"); // NOI18N
        RBAugmentedTF_Doc.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                RBAugmentedTF_DocActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(RBRawTF_Doc)
                    .addComponent(RBLogaritmicTF_Doc)
                    .addComponent(RBBinaryTF_Doc)
                    .addComponent(RBAugmentedTF_Doc))
                .addContainerGap(14, Short.MAX_VALUE))
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(RBRawTF_Doc)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(RBLogaritmicTF_Doc)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(RBBinaryTF_Doc)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(RBAugmentedTF_Doc)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder(resourceMap.getString("jPanel3.border.title"))); // NOI18N
        jPanel3.setName("jPanel3"); // NOI18N

        RBUsingIDF_Doc.setText(resourceMap.getString("RBUsingIDF_Doc.text")); // NOI18N
        RBUsingIDF_Doc.setName("RBUsingIDF_Doc"); // NOI18N
        RBUsingIDF_Doc.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                RBUsingIDF_DocActionPerformed(evt);
            }
        });

        RBNoneIDF_Doc.setText(resourceMap.getString("RBNoneIDF_Doc.text")); // NOI18N
        RBNoneIDF_Doc.setName("RBNoneIDF_Doc"); // NOI18N
        RBNoneIDF_Doc.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                RBNoneIDF_DocActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(RBNoneIDF_Doc)
                    .addComponent(RBUsingIDF_Doc))
                .addContainerGap(75, Short.MAX_VALUE))
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(RBNoneIDF_Doc)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(RBUsingIDF_Doc)
                .addContainerGap(59, Short.MAX_VALUE))
        );

        jPanel4.setBorder(javax.swing.BorderFactory.createTitledBorder(resourceMap.getString("jPanel4.border.title"))); // NOI18N
        jPanel4.setName("jPanel4"); // NOI18N

        RBUsingNormalization_Doc.setText(resourceMap.getString("RBUsingNormalization_Doc.text")); // NOI18N
        RBUsingNormalization_Doc.setName("RBUsingNormalization_Doc"); // NOI18N
        RBUsingNormalization_Doc.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                RBUsingNormalization_DocActionPerformed(evt);
            }
        });

        RBNoneNormalization_Doc.setText(resourceMap.getString("RBNoneNormalization_Doc.text")); // NOI18N
        RBNoneNormalization_Doc.setName("RBNoneNormalization_Doc"); // NOI18N
        RBNoneNormalization_Doc.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                RBNoneNormalization_DocActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
        jPanel4.setLayout(jPanel4Layout);
        jPanel4Layout.setHorizontalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(RBNoneNormalization_Doc)
                    .addComponent(RBUsingNormalization_Doc))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jPanel4Layout.setVerticalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(RBNoneNormalization_Doc)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(RBUsingNormalization_Doc)
                .addContainerGap(59, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jPanel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );

        jPanel5.setBorder(javax.swing.BorderFactory.createTitledBorder(resourceMap.getString("jPanel5.border.title"))); // NOI18N
        jPanel5.setName("jPanel5"); // NOI18N

        RBNoneStemming.setText(resourceMap.getString("RBNoneStemming.text")); // NOI18N
        RBNoneStemming.setName("RBNoneStemming"); // NOI18N
        RBNoneStemming.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                RBNoneStemmingActionPerformed(evt);
            }
        });

        RBUsingStemming.setText(resourceMap.getString("RBUsingStemming.text")); // NOI18N
        RBUsingStemming.setName("RBUsingStemming"); // NOI18N
        RBUsingStemming.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                RBUsingStemmingActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
        jPanel5.setLayout(jPanel5Layout);
        jPanel5Layout.setHorizontalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(RBNoneStemming)
                    .addComponent(RBUsingStemming))
                .addContainerGap(17, Short.MAX_VALUE))
        );
        jPanel5Layout.setVerticalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addComponent(RBNoneStemming)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(RBUsingStemming)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jPanel6.setBorder(javax.swing.BorderFactory.createTitledBorder(resourceMap.getString("jPanel6.border.title"))); // NOI18N
        jPanel6.setName("jPanel6"); // NOI18N

        RBUsingStopWord.setText(resourceMap.getString("RBUsingStopWord.text")); // NOI18N
        RBUsingStopWord.setName("RBUsingStopWord"); // NOI18N
        RBUsingStopWord.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                RBUsingStopWordMouseClicked(evt);
            }
        });

        RBNoneStopWord.setText(resourceMap.getString("RBNoneStopWord.text")); // NOI18N
        RBNoneStopWord.setName("RBNoneStopWord"); // NOI18N
        RBNoneStopWord.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                RBNoneStopWordMouseClicked(evt);
            }
        });

        javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6);
        jPanel6.setLayout(jPanel6Layout);
        jPanel6Layout.setHorizontalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel6Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(RBNoneStopWord)
                    .addComponent(RBUsingStopWord))
                .addContainerGap(13, Short.MAX_VALUE))
        );
        jPanel6Layout.setVerticalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel6Layout.createSequentialGroup()
                .addComponent(RBNoneStopWord)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(RBUsingStopWord)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        TextFieldStopWord.setEditable(false);
        TextFieldStopWord.setName("TextFieldStopWord"); // NOI18N

        TextFieldDocumentCollection.setEditable(false);
        TextFieldDocumentCollection.setName("TextFieldDocumentCollection"); // NOI18N

        TextFieldQuery.setEditable(false);
        TextFieldQuery.setName("TextFieldQuery"); // NOI18N

        TextFieldRelevantJudgement.setEditable(false);
        TextFieldRelevantJudgement.setName("TextFieldRelevantJudgement"); // NOI18N

        ButtonBrowseRelevantJudgement.setText(resourceMap.getString("ButtonBrowseRelevantJudgement.text")); // NOI18N
        ButtonBrowseRelevantJudgement.setName("ButtonBrowseRelevantJudgement"); // NOI18N
        ButtonBrowseRelevantJudgement.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                ButtonBrowseRelevantJudgementActionPerformed(evt);
            }
        });

        ButtonBrowseQuery.setText(resourceMap.getString("ButtonBrowseQuery.text")); // NOI18N
        ButtonBrowseQuery.setName("ButtonBrowseQuery"); // NOI18N
        ButtonBrowseQuery.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                ButtonBrowseQueryActionPerformed(evt);
            }
        });

        ButtonBrowseDocumentCollection.setText(resourceMap.getString("ButtonBrowseDocumentCollection.text")); // NOI18N
        ButtonBrowseDocumentCollection.setName("ButtonBrowseDocumentCollection"); // NOI18N
        ButtonBrowseDocumentCollection.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                ButtonBrowseDocumentCollectionActionPerformed(evt);
            }
        });

        ButtonBrowseStopWord.setText(resourceMap.getString("ButtonBrowseStopWord.text")); // NOI18N
        ButtonBrowseStopWord.setName("ButtonBrowseStopWord"); // NOI18N
        ButtonBrowseStopWord.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                ButtonBrowseStopWordActionPerformed(evt);
            }
        });

        jLabel1.setText(resourceMap.getString("jLabel1.text")); // NOI18N
        jLabel1.setName("jLabel1"); // NOI18N

        jLabel2.setText(resourceMap.getString("jLabel2.text")); // NOI18N
        jLabel2.setName("jLabel2"); // NOI18N

        jLabel3.setText(resourceMap.getString("jLabel3.text")); // NOI18N
        jLabel3.setName("jLabel3"); // NOI18N

        jLabel4.setText(resourceMap.getString("jLabel4.text")); // NOI18N
        jLabel4.setName("jLabel4"); // NOI18N

        ButtonOK.setText(resourceMap.getString("ButtonOK.text")); // NOI18N
        ButtonOK.setName("ButtonOK"); // NOI18N
        ButtonOK.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                ButtonOKActionPerformed(evt);
            }
        });

        jPanel7.setBorder(javax.swing.BorderFactory.createTitledBorder(resourceMap.getString("jPanel7.border.title"))); // NOI18N
        jPanel7.setName("jPanel7"); // NOI18N

        jPanel8.setBorder(javax.swing.BorderFactory.createTitledBorder(resourceMap.getString("jPanel8.border.title"))); // NOI18N
        jPanel8.setName("jPanel8"); // NOI18N

        RBRawTF_Query.setText(resourceMap.getString("RBRawTF_Query.text")); // NOI18N
        RBRawTF_Query.setName("RBRawTF_Query"); // NOI18N
        RBRawTF_Query.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                RBRawTF_QueryActionPerformed(evt);
            }
        });

        RBLogaritmicTF_Query.setText(resourceMap.getString("RBLogaritmicTF_Query.text")); // NOI18N
        RBLogaritmicTF_Query.setName("RBLogaritmicTF_Query"); // NOI18N
        RBLogaritmicTF_Query.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                RBLogaritmicTF_QueryActionPerformed(evt);
            }
        });

        RBBinaryTF_Query.setText(resourceMap.getString("RBBinaryTF_Query.text")); // NOI18N
        RBBinaryTF_Query.setName("RBBinaryTF_Query"); // NOI18N
        RBBinaryTF_Query.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                RBBinaryTF_QueryActionPerformed(evt);
            }
        });

        RBAugmentedTF_Query.setText(resourceMap.getString("RBAugmentedTF_Query.text")); // NOI18N
        RBAugmentedTF_Query.setName("RBAugmentedTF_Query"); // NOI18N
        RBAugmentedTF_Query.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                RBAugmentedTF_QueryActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel8Layout = new javax.swing.GroupLayout(jPanel8);
        jPanel8.setLayout(jPanel8Layout);
        jPanel8Layout.setHorizontalGroup(
            jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel8Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(RBRawTF_Query)
                    .addComponent(RBLogaritmicTF_Query)
                    .addComponent(RBBinaryTF_Query)
                    .addComponent(RBAugmentedTF_Query))
                .addContainerGap(14, Short.MAX_VALUE))
        );
        jPanel8Layout.setVerticalGroup(
            jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel8Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(RBRawTF_Query)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(RBLogaritmicTF_Query)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(RBBinaryTF_Query)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(RBAugmentedTF_Query)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jPanel9.setBorder(javax.swing.BorderFactory.createTitledBorder(resourceMap.getString("jPanel9.border.title"))); // NOI18N
        jPanel9.setName("jPanel9"); // NOI18N

        RBNoneIDF_Query.setText(resourceMap.getString("RBNoneIDF_Query.text")); // NOI18N
        RBNoneIDF_Query.setName("RBNoneIDF_Query"); // NOI18N
        RBNoneIDF_Query.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                RBNoneIDF_QueryActionPerformed(evt);
            }
        });

        RBUsingIDF_Query.setText(resourceMap.getString("RBUsingIDF_Query.text")); // NOI18N
        RBUsingIDF_Query.setName("RBUsingIDF_Query"); // NOI18N
        RBUsingIDF_Query.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                RBUsingIDF_QueryActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel9Layout = new javax.swing.GroupLayout(jPanel9);
        jPanel9.setLayout(jPanel9Layout);
        jPanel9Layout.setHorizontalGroup(
            jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel9Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(RBNoneIDF_Query)
                    .addComponent(RBUsingIDF_Query))
                .addContainerGap(78, Short.MAX_VALUE))
        );
        jPanel9Layout.setVerticalGroup(
            jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel9Layout.createSequentialGroup()
                .addComponent(RBNoneIDF_Query)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(RBUsingIDF_Query)
                .addContainerGap(60, Short.MAX_VALUE))
        );

        jPanel10.setBorder(javax.swing.BorderFactory.createTitledBorder(resourceMap.getString("jPanel10.border.title"))); // NOI18N
        jPanel10.setName("jPanel10"); // NOI18N

        RBNoneNormalization_Query.setText(resourceMap.getString("RBNoneNormalization_Query.text")); // NOI18N
        RBNoneNormalization_Query.setName("RBNoneNormalization_Query"); // NOI18N
        RBNoneNormalization_Query.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                RBNoneNormalization_QueryActionPerformed(evt);
            }
        });

        RBUsingNormalization_Query.setText(resourceMap.getString("RBUsingNormalization_Query.text")); // NOI18N
        RBUsingNormalization_Query.setName("RBUsingNormalization_Query"); // NOI18N
        RBUsingNormalization_Query.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                RBUsingNormalization_QueryActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel10Layout = new javax.swing.GroupLayout(jPanel10);
        jPanel10.setLayout(jPanel10Layout);
        jPanel10Layout.setHorizontalGroup(
            jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel10Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(RBNoneNormalization_Query)
                    .addComponent(RBUsingNormalization_Query))
                .addContainerGap(14, Short.MAX_VALUE))
        );
        jPanel10Layout.setVerticalGroup(
            jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel10Layout.createSequentialGroup()
                .addComponent(RBNoneNormalization_Query)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(RBUsingNormalization_Query)
                .addContainerGap(63, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout jPanel7Layout = new javax.swing.GroupLayout(jPanel7);
        jPanel7.setLayout(jPanel7Layout);
        jPanel7Layout.setHorizontalGroup(
            jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel7Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel9, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel10, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );
        jPanel7Layout.setVerticalGroup(
            jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel7Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                    .addComponent(jPanel10, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel9, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel8, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout mainPanelLayout = new javax.swing.GroupLayout(mainPanel);
        mainPanel.setLayout(mainPanelLayout);
        mainPanelLayout.setHorizontalGroup(
            mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(mainPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(mainPanelLayout.createSequentialGroup()
                        .addComponent(jPanel7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addContainerGap())
                    .addGroup(mainPanelLayout.createSequentialGroup()
                        .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(jPanel5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jPanel6, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                        .addGap(22, 22, 22))
                    .addGroup(mainPanelLayout.createSequentialGroup()
                        .addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(mainPanelLayout.createSequentialGroup()
                                .addComponent(jLabel3)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(TextFieldQuery, javax.swing.GroupLayout.DEFAULT_SIZE, 422, Short.MAX_VALUE))
                            .addGroup(mainPanelLayout.createSequentialGroup()
                                .addComponent(jLabel2)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(TextFieldDocumentCollection, javax.swing.GroupLayout.DEFAULT_SIZE, 421, Short.MAX_VALUE))
                            .addGroup(mainPanelLayout.createSequentialGroup()
                                .addComponent(jLabel1)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(TextFieldStopWord, javax.swing.GroupLayout.DEFAULT_SIZE, 422, Short.MAX_VALUE))
                            .addGroup(mainPanelLayout.createSequentialGroup()
                                .addComponent(jLabel4)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(TextFieldRelevantJudgement, javax.swing.GroupLayout.DEFAULT_SIZE, 422, Short.MAX_VALUE)))
                        .addGap(10, 10, 10)
                        .addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(ButtonBrowseRelevantJudgement)
                            .addComponent(ButtonBrowseQuery)
                            .addComponent(ButtonBrowseDocumentCollection)
                            .addComponent(ButtonBrowseStopWord))
                        .addGap(22, 22, 22))))
            .addGroup(mainPanelLayout.createSequentialGroup()
                .addGap(243, 243, 243)
                .addComponent(ButtonOK, javax.swing.GroupLayout.PREFERRED_SIZE, 154, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(263, Short.MAX_VALUE))
        );
        mainPanelLayout.setVerticalGroup(
            mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(mainPanelLayout.createSequentialGroup()
                .addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(mainPanelLayout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(mainPanelLayout.createSequentialGroup()
                        .addGap(21, 21, 21)
                        .addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jPanel6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jPanel7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(TextFieldStopWord, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel1)
                    .addComponent(ButtonBrowseStopWord))
                .addGap(9, 9, 9)
                .addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel2)
                    .addComponent(TextFieldDocumentCollection, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(ButtonBrowseDocumentCollection))
                .addGap(9, 9, 9)
                .addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel3)
                    .addComponent(TextFieldQuery, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(ButtonBrowseQuery))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel4)
                    .addComponent(TextFieldRelevantJudgement, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(ButtonBrowseRelevantJudgement))
                .addGap(18, 18, 18)
                .addComponent(ButtonOK)
                .addContainerGap(30, Short.MAX_VALUE))
        );

        menuBar.setName("menuBar"); // NOI18N

        fileMenu.setText(resourceMap.getString("fileMenu.text")); // NOI18N
        fileMenu.setName("fileMenu"); // NOI18N

        javax.swing.ActionMap actionMap = org.jdesktop.application.Application.getInstance(irsystem.view.IRSystemApp.class).getContext().getActionMap(IRSystemView.class, this);
        exitMenuItem.setAction(actionMap.get("quit")); // NOI18N
        exitMenuItem.setName("exitMenuItem"); // NOI18N
        fileMenu.add(exitMenuItem);

        menuBar.add(fileMenu);

        helpMenu.setText(resourceMap.getString("helpMenu.text")); // NOI18N
        helpMenu.setName("helpMenu"); // NOI18N

        aboutMenuItem.setAction(actionMap.get("showAboutBox")); // NOI18N
        aboutMenuItem.setName("aboutMenuItem"); // NOI18N
        helpMenu.add(aboutMenuItem);

        menuBar.add(helpMenu);

        statusPanel.setName("statusPanel"); // NOI18N

        statusPanelSeparator.setName("statusPanelSeparator"); // NOI18N

        statusMessageLabel.setName("statusMessageLabel"); // NOI18N

        statusAnimationLabel.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        statusAnimationLabel.setName("statusAnimationLabel"); // NOI18N

        progressBar.setName("progressBar"); // NOI18N

        javax.swing.GroupLayout statusPanelLayout = new javax.swing.GroupLayout(statusPanel);
        statusPanel.setLayout(statusPanelLayout);
        statusPanelLayout.setHorizontalGroup(
            statusPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(statusPanelSeparator, javax.swing.GroupLayout.DEFAULT_SIZE, 660, Short.MAX_VALUE)
            .addGroup(statusPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(statusMessageLabel)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 490, Short.MAX_VALUE)
                .addComponent(progressBar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(statusAnimationLabel)
                .addContainerGap())
        );
        statusPanelLayout.setVerticalGroup(
            statusPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(statusPanelLayout.createSequentialGroup()
                .addComponent(statusPanelSeparator, javax.swing.GroupLayout.PREFERRED_SIZE, 2, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(statusPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(statusMessageLabel)
                    .addComponent(statusAnimationLabel)
                    .addComponent(progressBar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(3, 3, 3))
        );

        setComponent(mainPanel);
        setMenuBar(menuBar);
        setStatusBar(statusPanel);
    }// </editor-fold>//GEN-END:initComponents

    private void RBRawTF_DocActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_RBRawTF_DocActionPerformed
        // TODO add your handling code here:
        this.codeTFDoc = RAW_TF;
}//GEN-LAST:event_RBRawTF_DocActionPerformed
    private void RBLogaritmicTF_DocActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_RBLogaritmicTF_DocActionPerformed
        // TODO add your handling code here:
        this.codeTFDoc = LOG_TF;
}//GEN-LAST:event_RBLogaritmicTF_DocActionPerformed
    private void RBBinaryTF_DocActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_RBBinaryTF_DocActionPerformed
        // TODO add your handling code here:
        this.codeTFDoc = BINARY_TF;
}//GEN-LAST:event_RBBinaryTF_DocActionPerformed
    private void RBAugmentedTF_DocActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_RBAugmentedTF_DocActionPerformed
        // TODO add your handling code here:
        this.codeTFDoc = AUGMENTED_TF;
}//GEN-LAST:event_RBAugmentedTF_DocActionPerformed

    private void RBUsingIDF_DocActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_RBUsingIDF_DocActionPerformed
        // TODO add your handling code here:
        this.isIDFDoc = true;
}//GEN-LAST:event_RBUsingIDF_DocActionPerformed
    private void RBNoneIDF_DocActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_RBNoneIDF_DocActionPerformed
        // TODO add your handling code here:
        this.isIDFDoc = false;
}//GEN-LAST:event_RBNoneIDF_DocActionPerformed

    private void RBUsingNormalization_DocActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_RBUsingNormalization_DocActionPerformed
        // TODO add your handling code here:
        this.isNormDoc = true;
}//GEN-LAST:event_RBUsingNormalization_DocActionPerformed
    private void RBNoneNormalization_DocActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_RBNoneNormalization_DocActionPerformed
        // TODO add your handling code here:
        this.isNormDoc = false;
}//GEN-LAST:event_RBNoneNormalization_DocActionPerformed

    private void RBNoneStemmingActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_RBNoneStemmingActionPerformed
        // TODO add your handling code here:
        this.isStemming = false;
}//GEN-LAST:event_RBNoneStemmingActionPerformed
    private void RBUsingStemmingActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_RBUsingStemmingActionPerformed
        // TODO add your handling code here:
        this.isStemming = true;
}//GEN-LAST:event_RBUsingStemmingActionPerformed

    private void RBUsingStopWordMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_RBUsingStopWordMouseClicked
        this.ButtonBrowseStopWord.setEnabled(true);
        this.isStopWord = true;
}//GEN-LAST:event_RBUsingStopWordMouseClicked
    private void RBNoneStopWordMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_RBNoneStopWordMouseClicked
        this.ButtonBrowseStopWord.setEnabled(false);
        this.isStopWord = false;
}//GEN-LAST:event_RBNoneStopWordMouseClicked

    private void ButtonBrowseRelevantJudgementActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ButtonBrowseRelevantJudgementActionPerformed
        // TODO add your handling code here:
        this.fc.setCurrentDirectory(this.currentDir);

        this.fc.setFileFilter(new javax.swing.filechooser.FileFilter() {
            @Override
            public boolean accept(File f) {
                return (f.getName().toLowerCase().endsWith(".rel") || f.isDirectory());
            }

            @Override
            public String getDescription() {
                return ("REL Files");
            }
        });

        if (this.fc.showOpenDialog(this.mainPanel) == javax.swing.JFileChooser.APPROVE_OPTION) {
            this.fileRJ = this.fc.getSelectedFile();
            this.currentDir = this.fc.getCurrentDirectory();
            this.TextFieldRelevantJudgement.setText(fileRJ.getAbsolutePath());
        }
}//GEN-LAST:event_ButtonBrowseRelevantJudgementActionPerformed

    private void ButtonBrowseQueryActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ButtonBrowseQueryActionPerformed
        // TODO add your handling code here:
        this.fc.setCurrentDirectory(this.currentDir);

        this.fc.setFileFilter(new javax.swing.filechooser.FileFilter() {
            @Override
            public boolean accept(File f) {
                return (f.getName().toLowerCase().endsWith(".qry") || f.isDirectory());
            }

            @Override
            public String getDescription() {
                return ("QRY Files");
            }
        });

        if (this.fc.showOpenDialog(this.mainPanel) == javax.swing.JFileChooser.APPROVE_OPTION) {
            this.fileQuery = this.fc.getSelectedFile();
            this.currentDir = this.fc.getCurrentDirectory();
            this.TextFieldQuery.setText(fileQuery.getAbsolutePath());
        }
}//GEN-LAST:event_ButtonBrowseQueryActionPerformed

    private void ButtonBrowseDocumentCollectionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ButtonBrowseDocumentCollectionActionPerformed
        // TODO add your handling code here:
        this.fc.setCurrentDirectory(this.currentDir);

        this.fc.setFileFilter(new javax.swing.filechooser.FileFilter() {
            @Override
            public boolean accept(File f) {
                return (f.getName().toLowerCase().endsWith(".all") || f.isDirectory());
            }

            @Override
            public String getDescription() {
                return ("ALL Files");
            }
        });

        if (this.fc.showOpenDialog(this.mainPanel) == javax.swing.JFileChooser.APPROVE_OPTION) {
            this.fileDC = this.fc.getSelectedFile();
            this.currentDir = this.fc.getCurrentDirectory();
            this.TextFieldDocumentCollection.setText(fileDC.getAbsolutePath());
        }
}//GEN-LAST:event_ButtonBrowseDocumentCollectionActionPerformed

    private void ButtonBrowseStopWordActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ButtonBrowseStopWordActionPerformed
        this.fc.setCurrentDirectory(this.currentDir);

        this.fc.setFileFilter(new javax.swing.filechooser.FileFilter() {
            @Override
            public boolean accept(File f) {
                return (f.getName().toLowerCase().endsWith(".stop") || f.isDirectory());
            }

            @Override
            public String getDescription() {
                return ("STOP Files");
            }
        });

        if (this.fc.showOpenDialog(this.mainPanel) == javax.swing.JFileChooser.APPROVE_OPTION) {
            this.fileStopWord = this.fc.getSelectedFile();
            this.currentDir = this.fc.getCurrentDirectory();
            this.TextFieldStopWord.setText(fileStopWord.getAbsolutePath());
        }
}//GEN-LAST:event_ButtonBrowseStopWordActionPerformed

    private void ButtonOKActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ButtonOKActionPerformed
        // TODO add your handling code here:
        try {
            if (fileDC != null) {
                this.fstreamDC = new FileInputStream(fileDC);
                if (fileQuery != null) {
                    this.fstreamQuery = new FileInputStream(fileQuery);
                    if (fileRJ != null) {
                        this.fstreamRJ = new FileInputStream(fileRJ);

                        if (fileDC.getName().equals("npl.all")){
                            Parse_DocumentCollection_NPL();
                        }else{
                            Parse_DocumentCollection_Default();
                        }

                        for (document doc : DC) {
                            for (String str : doc.getText()) {
                                if (!str.equals("'")) {
                                    if (str.startsWith("'") && str.endsWith("'")) ListTerm.add(str.substring(1, str.length()-2));
                                    else if (str.startsWith("'")) ListTerm.add(str.substring(1));
                                    else if (str.endsWith("'")) ListTerm.add(str.substring(0, str.length()-2));
                                    else ListTerm.add(str);
                                }
                            }
                        }

                        Parse_Query();

                        Parse_RJ();

                        if (isStopWord) {
                            if (fileStopWord != null) {
                                stopwords = new HashSet < String > ();
                                this.fstreamStopWord = new FileInputStream(fileStopWord);
                                importStopWord(fstreamStopWord);

                                for (document doc : DC){
                                    for (String str : doc.getText()){
                                        if (searchTermStopWord(str)) ListTerm.remove(str);
                                    }
                                }
                            } else {
                                javax.swing.JOptionPane.showMessageDialog(this.mainPanel, "file cannot be accessed", "data input error", javax.swing.JOptionPane.ERROR_MESSAGE);
                            }
                        }

                        if (isStemming) {
                            stemming();
                        }

                        //Term Weighting
                            System.out.println("document");
                            TermWeighting weight = new TermWeighting(ListTerm, DC.size(), codeTFDoc, isIDFDoc, isNormDoc, true);
                            invertedFile_Doc = weight.getInvertedFile();
                            System.out.println("query");
                            weight = new TermWeighting(ListTerm, Query.size(), codeTFQuery, isIDFQuery, isNormQuery, false);
                            invertedFile_Query = weight.getInvertedFile();

                        //write inverted file
                            writeToFile("output/invertedFileDoc.txt", true);
                            writeToFile("output/invertedFileQuery.txt", false);
                            javax.swing.JOptionPane.showMessageDialog(this.mainPanel, "index file has been made", "information", javax.swing.JOptionPane.INFORMATION_MESSAGE);

                    }else{
                        javax.swing.JOptionPane.showMessageDialog(this.mainPanel, "choose file Relevant Judgment", "data input error", javax.swing.JOptionPane.ERROR_MESSAGE);
                    }
                } else {
                    javax.swing.JOptionPane.showMessageDialog(this.mainPanel, "choose file Query", "data input error", javax.swing.JOptionPane.ERROR_MESSAGE);
                }
            } else {
                javax.swing.JOptionPane.showMessageDialog(this.mainPanel, "choose file Document Collection", "data input error", javax.swing.JOptionPane.ERROR_MESSAGE);
            }
        } catch (Exception e){
            javax.swing.JOptionPane.showMessageDialog(this.mainPanel, "file cannot be accessed", "data input error", javax.swing.JOptionPane.ERROR_MESSAGE);
        }
}//GEN-LAST:event_ButtonOKActionPerformed

    private void RBRawTF_QueryActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_RBRawTF_QueryActionPerformed
        // TODO add your handling code here:
        this.codeTFQuery = RAW_TF;
    }//GEN-LAST:event_RBRawTF_QueryActionPerformed
    private void RBLogaritmicTF_QueryActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_RBLogaritmicTF_QueryActionPerformed
        // TODO add your handling code here:
        this.codeTFQuery = LOG_TF;
    }//GEN-LAST:event_RBLogaritmicTF_QueryActionPerformed
    private void RBBinaryTF_QueryActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_RBBinaryTF_QueryActionPerformed
        // TODO add your handling code here:
        this.codeTFQuery = BINARY_TF;
    }//GEN-LAST:event_RBBinaryTF_QueryActionPerformed
    private void RBAugmentedTF_QueryActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_RBAugmentedTF_QueryActionPerformed
        // TODO add your handling code here:
        this.codeTFQuery = AUGMENTED_TF;
    }//GEN-LAST:event_RBAugmentedTF_QueryActionPerformed

    private void RBNoneIDF_QueryActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_RBNoneIDF_QueryActionPerformed
        // TODO add your handling code here:
        this.isIDFQuery = false;
    }//GEN-LAST:event_RBNoneIDF_QueryActionPerformed
    private void RBUsingIDF_QueryActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_RBUsingIDF_QueryActionPerformed
        // TODO add your handling code here:
        this.isIDFQuery = true;
    }//GEN-LAST:event_RBUsingIDF_QueryActionPerformed

    private void RBNoneNormalization_QueryActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_RBNoneNormalization_QueryActionPerformed
        // TODO add your handling code here:
        this.isNormQuery = false;
    }//GEN-LAST:event_RBNoneNormalization_QueryActionPerformed
    private void RBUsingNormalization_QueryActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_RBUsingNormalization_QueryActionPerformed
        // TODO add your handling code here:
        this.isNormQuery = true;
    }//GEN-LAST:event_RBUsingNormalization_QueryActionPerformed

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton ButtonBrowseDocumentCollection;
    private javax.swing.JButton ButtonBrowseQuery;
    private javax.swing.JButton ButtonBrowseRelevantJudgement;
    private javax.swing.JButton ButtonBrowseStopWord;
    private javax.swing.JButton ButtonOK;
    private javax.swing.JRadioButton RBAugmentedTF_Doc;
    private javax.swing.JRadioButton RBAugmentedTF_Query;
    private javax.swing.JRadioButton RBBinaryTF_Doc;
    private javax.swing.JRadioButton RBBinaryTF_Query;
    private javax.swing.JRadioButton RBLogaritmicTF_Doc;
    private javax.swing.JRadioButton RBLogaritmicTF_Query;
    private javax.swing.JRadioButton RBNoneIDF_Doc;
    private javax.swing.JRadioButton RBNoneIDF_Query;
    private javax.swing.JRadioButton RBNoneNormalization_Doc;
    private javax.swing.JRadioButton RBNoneNormalization_Query;
    private javax.swing.JRadioButton RBNoneStemming;
    private javax.swing.JRadioButton RBNoneStopWord;
    private javax.swing.JRadioButton RBRawTF_Doc;
    private javax.swing.JRadioButton RBRawTF_Query;
    private javax.swing.JRadioButton RBUsingIDF_Doc;
    private javax.swing.JRadioButton RBUsingIDF_Query;
    private javax.swing.JRadioButton RBUsingNormalization_Doc;
    private javax.swing.JRadioButton RBUsingNormalization_Query;
    private javax.swing.JRadioButton RBUsingStemming;
    private javax.swing.JRadioButton RBUsingStopWord;
    private javax.swing.JTextField TextFieldDocumentCollection;
    private javax.swing.JTextField TextFieldQuery;
    private javax.swing.JTextField TextFieldRelevantJudgement;
    private javax.swing.JTextField TextFieldStopWord;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel10;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JPanel jPanel6;
    private javax.swing.JPanel jPanel7;
    private javax.swing.JPanel jPanel8;
    private javax.swing.JPanel jPanel9;
    private javax.swing.JPanel mainPanel;
    private javax.swing.JMenuBar menuBar;
    private javax.swing.JProgressBar progressBar;
    private javax.swing.JLabel statusAnimationLabel;
    private javax.swing.JLabel statusMessageLabel;
    private javax.swing.JPanel statusPanel;
    // End of variables declaration//GEN-END:variables

    private final Timer messageTimer;
    private final Timer busyIconTimer;
    private final Icon idleIcon;
    private final Icon[] busyIcons = new Icon[15];
    private int busyIconIndex = 0;

    private JDialog aboutBox;
    private ButtonGroup bgTFDoc;
    private ButtonGroup bgIDFDoc;
    private ButtonGroup bgNormDoc;
    private ButtonGroup bgTFQuery;
    private ButtonGroup bgIDFQuery;
    private ButtonGroup bgNormQuery;
    private ButtonGroup bgStemming;
    private ButtonGroup bgStopWord;
}
